/*
 * @Author: yangni 920556271@qq.com
 * @Date: 2023-11-30 16:40:49
 * @LastEditors: yangni 920556271@qq.com
 * @LastEditTime: 2024-04-16 16:44:23
 * @FilePath: /yt-devops/lib/pages/devices/device_tab/model/device_item_model.dart
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import 'package:flutter/material.dart';
import 'package:yt_devops/model/device_model.dart';

class DetailItemModel {
  final String label;
  final String field;
  final TextStyle? labelStyles;
  final TextStyle? valueStyles;
  int? deviceId;
  Function? format;
  // 是否展示该字段
  bool Function(dynamic value, DeviceModel? model)? show;

  set setFormat(Function? formatFunc) => format = formatFunc;
  int? productTypeId;

  DetailItemModel(
      {required this.label,
      this.labelStyles,
      this.valueStyles,
      required this.field,
      this.deviceId,
      this.format,
      this.show,
      this.productTypeId});

  Map<String, dynamic> toJson() => {
        'label': label,
        'field': field,
        'format': format,
        'show': show,
        'deviceId': deviceId,
        'labelStyles': labelStyles,
        'valueStyles': valueStyles,
      };
}
